/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package library;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author mr2
 */
public class StatusBimbingan {
    
    Connection koneksi;
    private String StatusBimbingan;
    
    public StatusBimbingan(){
        koneksi = Koneksi.getKoneksi();
    }

    public String getStatusBimbingan() {
        return StatusBimbingan;
    }

    public void setStatusBimbingan(String StatusBimbingan) {
        this.StatusBimbingan = StatusBimbingan;
    }
    
    public List<StatusBimbingan> StatusBimbingan(){
        
        PreparedStatement prepare = null;
        ResultSet result = null;
        ArrayList<StatusBimbingan> listStatusBimbingan = new ArrayList<StatusBimbingan>();
        
        try{
            String sql = "SELECT * FROM statusbimbingan";
            
            prepare = koneksi.prepareStatement(sql);
            
            result = prepare.executeQuery();
            
            while(result.next()){
                StatusBimbingan Bimbingan = new StatusBimbingan();
                Bimbingan.setStatusBimbingan(result.getString("status_bimbingan"));
                
                listStatusBimbingan.add(Bimbingan);
            }
            return listStatusBimbingan;
            
        }catch(SQLException ex){
            System.out.print(ex.getMessage());
            return listStatusBimbingan;            
        }finally{
            if(prepare != null){
                try{
                    prepare.close();
                }catch(SQLException ex){
                    
                }
            }
            if(result != null){
                try{
                    result.close();
                }catch(SQLException ex){
                    
                }
            }
        }
        
    }
}
